<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 1.字符串
        let str="hello";
        // var arrs=str.split("");
        // console.log(arrs);

        // let [a,b,c,d,e]=str;
        // console.log(a);

        let [...arrs]=str;
        console.log(arrs);

        // 2.数值、布尔解构基本数据类型
                // a.将等号右侧的数据转换为对象数据
                // b.解构转换为对象的原型方法

        let num=123;//number
        let num2=new Number(123); //object
        console.log(Number.prototype);
        console.log(num2);

        let {toFixed}=num;
        console.log(toFixed);


        
        let data={
            status:true,
            msg:"嘿嘿，我是消息",
            list:[
                {a:1,b:2},
                {a:3,b:4},
                {a:5,b:6},
            ]
        };
        function show(obj){
            if(obj.status){
                for(let i=0;i<obj.list.length;i++){
                    console.log(obj.list[i]);
                }
            }else{
                console.log(obj.msg);
            }
        }
        show(data);
        // 函数参数的解构
        function show2({status,msg,list}){
            if(status){
                for(var i=0;i<list.length;i++){
                    console.log(list[i]);
                }
            }else{
                console.log(msg);
            }
        }
        show2(data);

        var result={
            "users":[
                {
                    "uid":1001,
                    "uname":"tom",
                    "usex":"男",
                    "udesc":"爱吃炸鸡，爱打游戏",
                    "className":"wbs20052"
                }
            ],
            "tool":"bike",
            "love":"上网"
        };
        // function show3({tool,love}){
        //     console.log(tool);
        //     console.log(love);
        // }
         function show3({users:[{uname,udesc}],tool,love}){
           console.log("我的名字："+uname+"，我的相关描述："+udesc+",我的交通工具："+tool+"，我的爱好:"+love);
        }
        show3(result);

        
        let {floor,ceil}=Math;
        console.log(floor(28.9));
        console.log(ceil(25.1));
    </script>
</head>
<body>
    
</body>
</html>